package com.fq.modules.sys.user.controller;

import com.fq.api.api.ApiRest;
import com.fq.api.api.controller.BaseController;
import com.fq.modules.sys.user.dto.SysUserLoginDTO;
import com.fq.modules.sys.user.enums.AccountType;
import com.fq.modules.sys.user.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 超chao
 * @Description 系统用户
 * @Date 2025/2/5/周三 9:20
 * @Version 1.0
 */
@Api(tags = {"系统用户"})
@RestController
@RequestMapping("/api/sys/user")
public class SysUserController extends BaseController {
    @Autowired
    private SysUserService baseService;
    /**
     * 登录
     */
    @RequestMapping(value = "/login",method = {RequestMethod.POST})
    @ApiOperation(value = "操作--账号（手机号）密码登录",notes = """
            加密格式：{
              "password": "123456",
              "username": "123456",
              "validTime": "1734601025459",
              "captchaKey": "uuid",
              "captchaValue": "adtg"
            }""")
    public ApiRest<SysUserLoginDTO> login(@RequestParam(value = "encryptData") String encryptData){
        return super.success(baseService.login(encryptData, AccountType.USER.getType()));
    }


}
